package com.htt.app.bienbaogiaothong.dialog;

import android.app.ProgressDialog;
import android.content.Context;

public class MyProgressDialog {

	private ProgressDialog progressDialog = null;
	
	private Context context;
	
	public MyProgressDialog(Context ctx) {
		this.context = ctx;
	}
	
	public void startProgress(String title, String message) {

		if(progressDialog==null) {
			progressDialog = new ProgressDialog(context); 
			progressDialog.setTitle(title); 
			progressDialog.setMessage(message);
			progressDialog.setCancelable(false);
			progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); 
			progressDialog.show(); 
		} else if(progressDialog != null && progressDialog.isShowing()) {
			progressDialog.setTitle(title); 
			progressDialog.setMessage(message);
		}
	
	}
	
	public void stopProgress() {
		if(progressDialog != null && progressDialog.isShowing()) {
			progressDialog.dismiss();
			progressDialog = null;
		}
	}

}
